package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.po.InteractionReply;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-03-26
 */
@Slf4j
@RestController
@RequestMapping("/replies")
@RequiredArgsConstructor
public class InteractionReplyController {
    private final IInteractionReplyService interactionReplyService;

    /**
     * 添加回复
     * @param replyDTO
     */
    @ApiOperation("增加回复")
    @PostMapping
    public void addReply(@RequestBody ReplyDTO replyDTO) {
        interactionReplyService.addReply(replyDTO);
    }

    /**
     * 分页查询
     * @param replyPageQuery
     */
    @ApiOperation("分页查询")
    @GetMapping("/page")
    public PageDTO<ReplyVO> getPage(ReplyPageQuery replyPageQuery) {
        return interactionReplyService.getPage(replyPageQuery, true);
    }
}

